<html>
<head>

<title>SSH tunneling using Cygwin</title>

</head>
<body>

<p>
<span class="InputHeader">SSH tunneling using Cygwin: The Desktop Unix Emulator</span>
<p>
<span class="PlainText"><b>SSH Guide: Index</b>
<p>

<ul>
	<dl>
<dt><a href="ddSSHGuide.html">About this guide</a>

<dd><a href="ddSSHGuide.html#aboutssh">About SSH</a></li>

<dd><a href="ddSSHGuide.html#furtherdocumentation">Further documentation</a></li>

<dt><a href="ddSSHGuideConcepts.html">Concepts</a>

<dt><a href="ddSSHGuideChoosing.html">Choosing the desktop terminal</a>

<dt><a href="ddSSHGuideTerminals.html">Using the desktop terminal</a>
	
	<dd><a href="ddSSHGuideTerminals.html#macs">Macintosh</a></dd>
	
	<dd><a href="ddSSHGuideTerminals.html#windows">Windows</a></dd>
	
<dt><b>You are here: Tunneling using Cygwin: The Desktop Unix Emulator
	<dd><a href="#installation">Installation</a>
	<dd><a href="#tunneling">Tunneling</a>
</b>

<dt><a href="ddSSHGuideterminating.html">Terminating the tunnel</a>

	</dl>
</ul>
<a href="/servlets/HelpTOC">Back to main Help index</a>

<p>
<hr noshade size=1>
<a name="installation"></a><span class="InputHeader">Installation</span>

<p>Before we can tunnel with Cygwin, it must be correctly installed.
<p>The most important consideration for installing Cygwin is creating
the appropriate Unix folders. Cygwin's <a
href="http://www.cygwin.com/" target="_new">website</a> offers complete and detailed
instructions; the below is an abbreviated version.</p>

<ul>

<li>Download and install Cygwin. Cygnus gives you the option of installing from the Web, but it is faster (and ultimately more efficient) to install from a local disk. So just download and save the file somewhere you can easily find it.</li>

<li>Click on Cygwin's "setup.exe" icon and follow the instructions, accepting the defaults. At some point, you will be asked for text format and whether you want Cygwin to be for yourself alone or to be shared. It doesn't matter whether you choose DOS or Unix, but for the sake of ease of use, choose Unix and "All." Cygwin will then install, and should create icons in your start file as well as on your desktop. If it doesn't, run setup again. Nothing will be installed if nothing needs to be, but it will take you to the end, where you can check the boxes indicating you want the icons installed. Check them.</li>

<li>At this point, you need to create the Unix folders. You can create the standard directories from within Cygwin, as Cygwin's configuration instructions suggest (<a href="http://www.cygwin.com/cygwin-ug-net/setup-dir.html" target="_new">http://www.cygwin.com/cygwin-ug-net/setup-dir.html</a>), or you can set them up from within Windows. Using the Windows method has some advantages, especially for people who are not entirely familiar with Unix commands and protocols. Since Cygwin is able to read both Win32 (Windows) file paths as well as Unix ones (POSIX), it doesn't much matter how you do it.</li>

<li>Very clear instructions for creating the Unix directories can be found at <a href="http://www.woodsoup.org/projs/ORKiD/basic.htm" target="_new">http://www.woodsoup.org/projs/ORKiD/basic.htm</a>. Although the instructions are specifically for a slightly earlier version of the program, they still obtain: the typical Unix directories must still be created. 

<li>As well, the cygwin.bat file needs to be modified. Cygnus suggests that other files, too, need modification; but of these, the .bat file, which specifies the commands and their sequence that bash must go through, needs immediate modification. 

<li>Configure your cygwin.bat file using Windows' Notepad utility or other text editor (not Microsoft Word or anything that imparts formatting) so that it looks something like this:</li>

</ul>

  <ul><p><span class="TypewriterPlain">@ECHO OFF<br>

  SET MAKE_MODE=Unix<br>

  SET CYGWIN=notty<br>

  SET HOME=C:\unix\HOME\[your home directory name]<br>

  SET TERM=VT100<br>


  CHDIR C:\Unix\HOME\[your home directory name]<br>

  SET PATH=C:\Unix\BIN;C:\Unix\USR\LOCAL\BIN;C:\CYGWIN\BIN;%PATH%<br>

  BASH</span><br>

  </ul>
<ul>

<p><li>Where the "unix" directory on the "C" drive contains the traditional Unix directories. You can name it anything you want, as long a you do not use anything that confuses Unix, e.g., hyphens, spaces, etc. 

<li>You should now have the C:\Cygwin directories, and your own C:\unix directories, which include your crucial home directory. 

<li>There is still one more, optional, step. For Cygwin to run efficiently, you might want to configure the shortcut icon on your desktop so that it starts the program in the right directory. This is not necessary, if you have stipulated the HOME directory in the .bat file.</li>

<li>Cygwin offers some further refinements, and, to be sure, there will doubtless be some tweaking you will have to do to make have the program running efficiently. Again, if you are familiar with Unix commands and file structures, you will find this easy; if you are not, Cygwin is quite forgiving, and you can get started with a minimum of fuss. </li>
</ul>
<p>

<hr noshade size=1>
<a name="tunneling"></a><span class="InputHeader">Tunneling</span>
<ul>

<li>First, begin the program.</li>

<li>At the prompt, enter "<span class="TypewriterPlain">ssh -x -L 2401:localhost:2401 tunnel@thisdomain.com</span>"</li>

  <li>The server should ask you for your password. Enter it. It is "<span class="TypewriterPlain">tunnel</span>"</li>

  <li>If this is your first time, the server will send you a message along these lines:

  <ul>

  <li><span class="TypewriterPlain">Host key not found from the list of known hosts.</span> </li>

  <li><span class="TypewriterPlain">Are you sure you want to continue connecting (yes/no)?</span> </li>

  </ul>

  </li>

  <li>Enter "<span class="TypewriterPlain">Yes</span>." You can't just enter "y"; you have to spell it out. <li>The server will then respond with: "<span class="TypewriterPlain">Host "thisdomain.com" added to the list of known hosts.</span>" 

  <li>The screen does not show a prompt. That's how it should be. The tunnel has been established. You are now ready to begin using CVS. <li>You can, at this point, minimize the terminal, but do not close it or enter <span class="TypewriterPlain">Ctrl-C (^C)</span>. Doing so will kill the terminal tunnel.</li>

</ul>
<p>

<hr noshade size=1>
<a href="/servlets/HelpTOC">Back to main Help index</a>
</span>
</body>
</html>
